package com.szzg10.thinking.chapter18;

import java.io.File;

public class ProcessFiles {
	public interface Strategy {
		public void process(File file);
	}
	
	private Strategy strategy;
	
	public ProcessFiles(Strategy strategy) {
		this.strategy = strategy;
	}
	
	public void doIt() {
		File file = new File("D:/workspace/szzg10/src");
		
		TreeInfo treeInfo = Directory.recuiseDirs(file);
		for(File element: treeInfo.dirs) {
			strategy.process(element);
		}
	}
	
	public static void main(String[] args) {
		ProcessFiles processFiles = new ProcessFiles(new Strategy() {
			@Override
			public void process(File file) {
				System.out.println(file.getName());
			}
		});
		
		processFiles.doIt();
	}
}
